<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>图书列表</title>
    <style>
        body {
            margin: 0;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
            color: #e0f7fa;
        }

        h1 {
            text-align: center;
            margin: 40px 0 20px;
            font-size: 2.8em;
            color: #00fff7;
            text-shadow: 0 0 10px #00fff7;
        }

        nav {
            text-align: center;
            margin-bottom: 30px;
        }

        nav a {
            color: #00fff7;
            font-weight: 600;
            margin: 0 12px;
            text-decoration: none;
            transition: color 0.3s ease;
            font-size: 1.1em;
        }

        nav a:hover {
            color: #ffffff;
            text-shadow: 0 0 8px #00fff7;
        }

        p a {
            display: inline-block;
            margin: 0 0 20px 20px;
            padding: 10px 18px;
            background: linear-gradient(90deg, #00c9ff, #92fe9d);
            color: #000;
            font-weight: 700;
            border-radius: 10px;
            box-shadow: 0 0 15px rgba(0, 255, 255, 0.6);
            text-decoration: none;
            transition: transform 0.25s ease, box-shadow 0.25s ease;
        }

        p a:hover {
            transform: scale(1.1);
            box-shadow: 0 0 25px rgba(0, 255, 255, 0.9);
        }

        table {
            width: 90%;
            max-width: 1200px;
            margin: 0 auto 60px;
            border-collapse: separate;
            border-spacing: 0 15px;
            background: rgba(255, 255, 255, 0.08);
            backdrop-filter: blur(10px);
            border-radius: 15px;
            box-shadow: 0 0 30px rgba(0, 255, 255, 0.15);
            color: #e0f7fa;
        }

        th, td {
            padding: 15px 20px;
            text-align: left;
        }

        th {
            background: rgba(0, 255, 255, 0.3);
            font-weight: 700;
            font-size: 1.05em;
            border-top-left-radius: 15px;
            border-top-right-radius: 15px;
            text-shadow: 0 0 3px #00fff7;
        }

        tr {
            background: rgba(0, 0, 0, 0.15);
            transition: background-color 0.3s ease;
            border-radius: 12px;
        }

        tr:hover {
            background: rgba(0, 255, 255, 0.25);
            box-shadow: 0 0 15px #00fff7;
        }

        td a {
            color: #00fff7;
            font-weight: 600;
            text-decoration: none;
            margin-right: 12px;
            transition: color 0.3s ease, text-shadow 0.3s ease;
        }

        td a:hover {
            color: #ffffff;
            text-shadow: 0 0 8px #00fff7;
        }

        td:last-child {
            white-space: nowrap;
        }

        /* 提示暂无数据的样式 */
        tr:nth-child(n+2):empty td {
            text-align: center;
            color: #66ffffaa;
            font-style: italic;
            font-size: 1.1em;
        }

        @media (max-width: 800px) {
            table, th, td {
                font-size: 0.9em;
            }

            nav a {
                display: inline-block;
                margin: 8px 10px;
            }
        }
    </style>
</head>
<body>
    <h1>图书列表</h1>
    <nav>
        <a href="/">首页</a> |
        <a href="/books">图书管理</a> |
        <a href="/categories">分类管理</a> |
        <a href="/users">用户管理</a> |
        <a href="/borrows">借阅管理</a> |
        <a href="/logs">日志查看</a>
    </nav>
    <p><a href="/books/add">添加新图书</a></p>
    <table>
        <tr><th>ID</th><th>标题</th><th>作者</th><th>出版社</th><th>分类</th><th>出版日期</th><th>操作</th></tr>
        {{range .Books}}
        <tr>
            <td>{{.ID}}</td>
            <td>{{.Title}}</td>
            <td>{{.Author}}</td>
            <td>{{.Publisher}}</td>
            <td>{{.Category.Name}}</td>
            <td>{{.PublishedAt.Format "2006-01-02"}}</td>
            <td>
                <a href="/books/{{.ID}}">详情</a> |
                <a href="/books/edit/{{.ID}}">编辑</a> |
                <a href="/books/delete/{{.ID}}" onclick="return confirm('确定删除？')">删除</a>
            </td>
        </tr>
        {{else}}
        <tr><td colspan="7">暂无数据</td></tr>
        {{end}}
    </table>
</body>
</html>
